﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using ThresholdAssistant.DataContract.Result;
using ThresholdAssistant.WebAPI.Service.JobService;

namespace ThresholdAssistant.WebAPI.Controllers
{
    /// <summary>
    /// 测试控制器
    /// </summary>
    [Route("api/test")]
    public class TestController : BaseController
    {
        public ReadFileToSendSmsService ReadFileToSendSmsService { get; set; }
        /// <summary>
        /// 发送
        /// </summary>
        /// <returns></returns>
        [HttpPost("send")]
        [AllowAnonymous]
        public async Task<ContractResult> SendAsync()
        {
            await ReadFileToSendSmsService.ExecuteAsync();
            return new ContractResult
            {
                Success = true,
                ErrorCode = "0",
                ErrorMessage = "发送成功"
            };
        }
    }
}